home *** CD-ROM | disk | FTP | other *** search
/ BMUG Revelations / BMUG Revelations.toast / Programming / Programming Languages / PC Basic / PCBASIC Stand alone version / PCBASIC Runtime / PCBASICConst.asm next >
Assembly Source File  |  1986-06-09  |  11KB  |  384 lines

  1. ;
  2. ;     BASICmacconst   4/15/86
  3. ;
  4. ;   PCBASIC run-time variable definitions
  5. ;
  6. ;   Macintosh Native Object code version
  7. ;
  8. ;    by Pterodactyl Software, Copyright, 1985
  9. ;
  10. ;  Environment
  11. ;
  12.         texp    0
  13.         mexp    0
  14.         locsym    '@'
  15.         noloc
  16. ;
  17. ;
  18. ;  Variable  Definitions by Offset
  19. ;
  20. ;
  21. str$top        equ    -4    ;        strtop: longint;   { Pointer to end of strings}
  22. str$ptr        equ    str$top-4    ;        strptr: longint;   { Pointer to string-area segment}
  23. heap$len    equ    str$ptr-4    ;        heaplen: longint;  { Length of file-area  segment}
  24. heap$ptr    equ    str$ptr-8    ;        heaptr: longint;   { Pointer to file-area  segment}
  25. scrn$ptr    equ    heap$ptr-4    ;        scrnptr: longint;  { Pointer to screen-area  segment}
  26. trap$ptr    equ    scrn$ptr-4    ;        trapptr : ptr;           { Pointer to trap-area segment}
  27. trap$len    equ    trap$ptr-2    ;        traplen : integer; { Length of trap-area segment}
  28. bor$hand    equ    trap$len-4    ;        border: RgnHandle; { Border region}
  29. line$num    equ    bor$hand-2    ;        line_no: integer;  { BASIC Line Number}
  30. err$num        equ    line$num-2    ;        err_no: integer;   { Error number }
  31. c$ommand    equ    err$num-2    ;        command: integer;  { Pascal routine to execute }
  32. file$buf    equ    c$ommand-258    ;        pad   : integer;   { I/O may overshoot buffer }
  33. ;        file_str: string [255]; {record for I/O}
  34. file$len    equ    file$buf    ;          first byte of string is length
  35. file$str    equ    file$buf+1    ;          then data follows
  36. file$num    equ    file$buf-4    ;        file_num: longint; {reference number for file I/O}
  37. file$ptr    equ    file$num-4    ;        file_ptr: longint; {pointer to file I/O buffer}
  38. ;  conversion parameter
  39. int$x        equ    file$ptr-2    ;        intx  : integer;   { Integer input}
  40. int$y        equ    int$x-2    ;        inty  : integer;   { Integer input}
  41. fp$x        equ    int$y-4    ;        fpx   : real;           { Floating input}
  42. fp$y        equ    fp$x-4    ;        fpy   : real;           { Floating output}
  43. str$x        equ    fp$y-256    ;        strx  : string[255] { String input}
  44. str$y        equ    str$x-30    ;        stry  : string[29] { String output}
  45. ; device parameters
  46. pos$1        equ    str$y-2    ;        pos1  : integer;   { Printer 1 column, 1..132}
  47. wid$1        equ    pos$1-2    ;        wid1  : integer;   { Printer 1 width,  1 .. 255}
  48. pos$2        equ    wid$1-2    ;        pos2  : integer;   { Printer 2 column, 1..132}
  49. wid$2        equ    pos$2-2    ;        wid2  : integer;   { Printer 2 width,  1 .. 255}
  50. pos$3        equ    wid$2-2    ;        pos3  : integer;   { Printer 3 column, 1..132}
  51. wid$3        equ    pos$3-2    ;        wid3  : integer;   { Printer 3 width,  1 .. 255}
  52. ;  screen parameters
  53. pos$0        equ    wid$3-2    ;        pos0  : integer;   { Cursor column, 1..80}
  54. wid$0        equ    pos$0-2    ;        wid0  : integer;   { Screen width, 40 or 80}
  55. csr$lin        equ    wid$0-2    ;        csrlin: integer;   { Cursor line,   1..25}
  56. lp$x        equ    csr$lin-2    ;        lpx   : integer;   { x coörd of last point refereneced }
  57. lp$y        equ    csr$lin-4    ;        lpy   : integer;   { y coörd of last point refereneced }
  58. ap$x        equ    csr$lin-6    ;        apx   : integer;   { x coörd of point A }
  59. ap$y        equ    csr$lin-8    ;        apy   : integer;   { y coörd of point A }
  60. bp$x        equ    csr$lin-10    ;        bpx   : integer;   { x coörd of point B }
  61. bp$y        equ    csr$lin-12    ;        bpy   : integer;   { y coörd of point B }
  62. a$spect        equ    csr$lin-16    ;        aspect: real;           { Circle aspect ratio}
  63. def$asp        equ    a$spect-4    ;        DefAspect :real;   {Default value for aspect}
  64. csr$ptrn    equ    def$asp-68    ;        csrpat: cursor;    { Cursor data,
  65. csr$mask    equ    csr$ptrn+32    ;                      mask,
  66. csr$spot    equ    csr$mask+32    ;                      and hot spot}
  67. edit$rec    equ    csr$ptrn-28    ;        EditRect: rect           { Window data area}
  68. cfig$upd    equ    csr$ptrn-30    ;        CfigUpdate: integer{ Update & buffer options}
  69. vis$pg        equ    csr$ptrn-31    ; byte          visual (top)          page        LSB
  70. act$page    equ    csr$ptrn-32    ; byte          active (output) page        MSB
  71. ;
  72. ;
  73. asm$var        equ    act$page-1200    ;        asmvar: array [1..300] of longint
  74. ;
  75. ;
  76. ; screen ASM values
  77. max$pg        equ    asm$var+18    ; byte         maximum page num in use for seg size
  78. for$col        equ    asm$var+19    ; byte         foreground color or pen pattern
  79. back$col    equ    asm$var+20    ; byte         background color
  80. bor$col        equ    asm$var+21    ; byte         border color or text face
  81. scrn$mode    equ    asm$var+22    ; word         screen mode. >2 -> font(n)
  82. csr$vue        equ    asm$var+24    ; word         0=hide cursor, 1=show, else init
  83. csr$flg        equ    asm$var+26    ; byte         $40 -> Show carret. $80 -> On screen
  84. csr$top        equ    asm$var+28    ; word         first cursor line
  85. csr$bot        equ    asm$var+30    ; word         last cursor scan line
  86. csr$pnt        equ    asm$var+32    ; long         pointer into active page
  87. text$mod    equ    asm$var+36    ; byte         mode for drawing text
  88. text$fac    equ    asm$var+37    ; byte         text face
  89. font$asc    equ    asm$var+38    ; word         text font Ascent
  90. font$des    equ    asm$var+40    ; word         text font Descent
  91. ; zooming values
  92. view$lft    equ    asm$var+44    ; word        clip region & viewport left
  93. view$top    equ    asm$var+46    ; word        clip region & viewport top
  94. view$rt        equ    asm$var+48    ; word        clip region & viewport right
  95. view$bot    equ    asm$var+50    ; word        clip region & viewport bottom
  96. wind$lft    equ    asm$var+52    ; long        window left
  97. wind$top    equ    asm$var+56    ; long        window top
  98. wind$rt        equ    asm$var+60    ; long        window right
  99. wind$bot    equ    asm$var+64    ; long        window bottom
  100. vuoff$x        equ    asm$var+68    ; word        viewport x offset
  101. vuoff$y        equ    asm$var+70    ; word        viewport y offset
  102. wdoff$x        equ    asm$var+72    ; long        window x offset
  103. wdoff$y        equ    asm$var+76    ; long        window y offset
  104. wdmul$x        equ    asm$var+80    ; long        window x multiplier or 0 if no window
  105. wdmul$y        equ    asm$var+84    ; long        window y multiplier or 0 if no window
  106. ;
  107. err$adr        equ    asm$var+92    ; long         address for error retry
  108. file$mode    equ    asm$var+100    ; word          file I/O mode command for open
  109. rec$num        equ    file$mode+2    ; long          record nuimber for get or put
  110. fil$hands    equ    file$mode+6    ; long          file handles available
  111. line$adr    equ    file$mode+10    ; long          line start+4 in case of error
  112. retry$stk    equ    line$adr+4    ; long          restore to A7 on error retry
  113. stack$bot    equ    line$adr+8    ; long          restore to A7 for new program
  114. err$line    equ    line$adr+12    ; long          line start for error retry
  115. err$vect    equ    err$line+4    ; long          error handler address
  116. data$ptr    equ    err$vect+8    ; long          pointer to next DATA statement
  117. inp$retry    equ    err$vect+12    ; long          prompt display for input retry
  118. inp$stack    equ    err$vect+16    ; long          stack point for input retry
  119. seq$flg        equ    err$vect+21    ; byte          Seq disk file compatibility
  120. trac$lin    equ    err$vect+22    ; word          Last line number displayed
  121. opt$base    equ    err$vect+28    ; word          min array number, option base
  122. dflt$flg    equ    opt$base+2    ; byte          $FF -> default device
  123. prec$flg    equ    opt$base+3    ; byte          precision of operation
  124. field$pnt    equ    opt$base+4    ; long          pntr into file buf during FIELD
  125. width$255    equ    opt$base+8    ; long          default width and position
  126. ;
  127. ;  Keyboard and Mouse
  128. ;
  129. keyin$idx    equ    opt$base+18    ;  byte          pointer into key input string
  130. key$in        equ    opt$base+20    ;  long          string for function key input
  131. ; mouse(0) .. mouse(6)              ; 14 bytes  mouse function values
  132. mouse$y        equ    opt$base+28    ;  word           MOUSE(2)
  133. mouse$x        equ    opt$base+30    ;  word           MOUSE(1)
  134. Atr$byte    equ    mouse$y+21    ;  byte           current Screen atribute
  135. Atr$Off        equ    mouse$y+22    ;  word           size of text buffer
  136. Cur$Evt        equ    mouse$y+24    ;  Event record
  137. Cur$What    equ    Cur$Evt    ;  word          Type of Event
  138. Cur$Msg        equ    Cur$Evt+2    ;  long          Info about event
  139. Cur$time    equ    Cur$Evt+6    ;  long          Tick when event occured
  140. Cur$msy        equ    Cur$Evt+10    ;  word           Event mouse y
  141. Cur$msx        equ    Cur$Evt+12    ;  word           Event mouse x
  142. Cur$Mod        equ    Cur$Evt+14    ;  word          Event case keys
  143. ;
  144. ;  Register Storage
  145. ;
  146. pas$reg        equ    Cur$Evt+72    ; 36 bytes    Pascal registers while in ASM
  147. asm$reg        equ    pas$reg+52    ; 40 bytes    ASM registers while in Pascal
  148. ;                              A0 has return address
  149. ;  LFN pointer table
  150. ;
  151. lfn$ptr        equ    asm$reg+44    ; 520 bytes   LFN Pointers to file buffers
  152. ;
  153. ;  Vector into generated code
  154. ;
  155. code$start    equ    lfn$ptr+772    ; long              Start of current program
  156. ;
  157. ; entries to BASIC run-time code
  158.     Xref    Menu$Num
  159.     Xref    Wind$Num
  160.     Xref    l$$ea
  161.     Xref    dia$log
  162.     Xref    err$or
  163.     Xref    p$ause
  164.     Xref    r$esume
  165.     Xref    r$eturn
  166.     Xref    new$lin
  167.     Xref    new$pro
  168.     Xref    ret$pro
  169.     Xref    int$chk
  170.     Xref    trap$enab
  171.     Xref    key$on
  172.     Xref    key$off
  173.     Xref    key$list
  174.     Xref    key$set
  175.     Xref    heap$chk
  176.     Xref    pack$str
  177.     Xref    pack$ra
  178.     Xref    pack$sra
  179.     Xref    code$bot
  180.     Xref    e$nd
  181.     Xref    dim$pro
  182.     Xref    dim$fin
  183.     Xref    dim$chk
  184.     Xref    dim$val
  185.     Xref    add$str
  186.     Xref    r$4sng
  187.     Xref    r$4int
  188.     Xref    data$in
  189.     Xref    data$par
  190.     Xref    r$estore    ; 2/3/85
  191.     Xref    dyn$mode
  192.     Xref    c$lear
  193.     Xref    set$file
  194.     Xref    open$file
  195.     Xref    c$lose
  196.     Xref    cl$all
  197.     Xref    inp$beg
  198.     Xref    inp$int
  199.     Xref    inp$sng
  200.     Xref    inp$dbl
  201.     Xref    inp$str
  202.     Xref    inp$lin
  203.     Xref    init$prus
  204.     Xref    pr$comma
  205.     Xref    pr$cr
  206.     Xref    pr$qm
  207.     Xref    pr$sng
  208.     Xref    pr$dbl
  209.     Xref    pr$int
  210.     Xref    pr$str
  211.     Xref    pr$tab
  212.     Xref    pr$htab
  213.     Xref    pr$spac
  214.     Xref    pr$btl
  215.     Xref    prus$int
  216.     Xref    prus$str
  217.     Xref    prus$sng
  218.     Xref    prus$dbl
  219.     Xref    prus$end
  220.     Xref    wr$cr
  221.     Xref    wr$int
  222.     Xref    wr$str
  223.     Xref    wr$sng
  224.     Xref    wr$dbl
  225.     Xref    l$oc
  226.     Xref    l$of
  227.     Xref    e$of
  228.     Xref    l$pos
  229.     Xref    wid$num
  230.     Xref    wid$str
  231.     Xref    e$ject
  232.     Xref    get$rec
  233.     Xref    put$rec
  234.     Xref    next$rec
  235.     Xref    k$ill
  236.     Xref    f$iles
  237.     Xref    ch$dir
  238.     Xref    re$name
  239.     Xref    c$hain
  240.     Xref    d$raw
  241.     Xref    c$ircle
  242.     Xref    l$ine
  243.     Xref    b$ox
  244.     Xref    box$fill
  245.     Xref    clr$scrn
  246.     Xref    clr$view
  247.     Xref    view$scrn
  248.     Xref    view$set
  249.     Xref    clr$wind
  250.     Xref    wind$scrn
  251.     Xref    wind$set
  252.     Xref    get$graph
  253.     Xref    put$graph
  254.     Xref    c$olor
  255.     Xref    l$ocate
  256.     Xref    csr$pat
  257.     Xref    scrn$pro
  258.     Xref    scrn$num
  259.     Xref    poin$num
  260.     Xref    poin$cor
  261.     Xref    plot$pro
  262.     Xref    p$map
  263.     Xref    p$lay
  264.     Xref    s$ound
  265.     Xref    m$ouse
  266.     Xref    t$imer
  267.     Xref    time$pro
  268.     Xref    time$str
  269.     Xref    date$pro
  270.     Xref    date$str
  271.     Xref    pen$num
  272.     Xref    str$dbl
  273.     Xref    sng$dbl
  274.     Xref    val$num
  275.     Xref    str$int
  276.     Xref    int$dlr
  277.     Xref    sng$dlr
  278.     Xref    dbl$dlr
  279.     Xref    sng$fix
  280.     Xref    sng$int
  281.     Xref    dbl$fix
  282.     Xref    dbl$int
  283.     Xref    re$long
  284.     Xref    re$cint
  285.     Xref    dbl$cint
  286.     Xref    dbl$sng
  287.     Xref    cv$i
  288.     Xref    cv$s
  289.     Xref    cv$d
  290.     Xref    mk$i
  291.     Xref    mk$s
  292.     Xref    mk$d
  293.     Xref    oct$str
  294.     Xref    hex$str
  295.     Xref    in$key
  296.     Xref    in$str
  297.     Xref    in$putstr
  298.     Xref    copy$heap
  299.     Xref    lit$str
  300.     Xref    l$set
  301.     Xref    r$set
  302.     Xref    mid$pro
  303.     Xref    stri$str
  304.     Xref    cmp$str
  305.     Xref    r$andom
  306.     Xref    sng$ipwr
  307.     Xref    dbl$ipwr
  308.     Xref    exp$sng
  309.     Xref    cmp$sing
  310.     Xref    dbl$sqrt
  311.     Xref    dbl$cos
  312.     Xref    dbl$sin
  313.     Xref    dbl$exp
  314.     Xref    tan$dbl
  315.     Xref    exp$dbl
  316.     Xref    dbl$atan
  317.     Xref    dbl$ln
  318.     Xref    add$dbl
  319.     Xref    div$dbl
  320.     Xref    mul$dbl
  321.     Xref    cmp$dbl
  322.     Xref    sub$dbl
  323. ; iosfplib links
  324.     Xref    add$sing    ; sing add
  325.     Xref    sub$sing    ; sing subtract
  326.     Xref    mul$sing    ; sing multiply
  327.     Xref    div$sing    ; sing divide
  328.     Xref    sng$sin    ; sing sine
  329.     Xref    sng$cos    ; sing cosine
  330.     Xref    tan$sng    ; sing tangent
  331.     Xref    sng$flt    ; longint to sing
  332.     Xref    sng$exp    ; sing e ** x
  333.     Xref    sng$ln    ; sing nat log
  334.     Xref    sng$sqrt    ; sing square root
  335.     Xref    sng$atan    ; sing arctangent
  336. ;
  337. ; Code Generation Condensing Macros
  338. ;
  339. n$p macro &1
  340.  jsr new$pro
  341.  DC.w &1-seg$tab
  342.  endm
  343. ;
  344. r$p macro &1,&2
  345.  jsr ret$pro
  346.  DC.w &1-seg$tab
  347.  DC.w $&2
  348.  endm
  349. ;
  350. n$l macro &1,&2,&3
  351.   ;
  352. &1 jsr new$lin
  353.  DC.w &2-seg$tab
  354.  DC.w seg$code
  355.  DC.w $&3
  356.  endm
  357. ;
  358. l$ea macro &1,&2
  359.  lea &1,A0
  360.  jsr l$$ea
  361.  move.l D0,&2
  362.  endm
  363. ;
  364. go$sub macro &1
  365. ; @93 move.l #seg$code*65536+10+@93-seg$tab,-(A7)
  366.   DC.W    $2F3C,seg$code
  367.   DC.W    *-seg$tab+6
  368.   jmp    &1
  369.  endm
  370. ;
  371. r$ead macro
  372. ; @93 move.l #seg$code*65536+14+@93-seg$tab,-(A7)
  373.   DC.W    $2F3C,seg$code
  374.   DC.W    *-seg$tab+10
  375.   move.l Data$Ptr(A5),-(A7)
  376.   jmp r$eturn
  377.  endm
  378. ;
  379. ;
  380. ;
  381.  
  382.  
  383.  
  384.